home *** CD-ROM | disk | FTP | other *** search
-
- ~4Dgifts/toolbox/src/exampleCode/networking/short_timeout README
-
-
-
- hrq: host_responds_quickly
-
- Code that checks whether a remote host responds quickly, avoiding
- a long wait for a network timeout.
-
-
- A developer of a networked application may want to know if a host
- is present on the network before the application attempts to make
- use of some resource on that host. The default network timeouts
- are suitable for use on a WAN, and may seem too lengthy for LAN
- users.
-
- The application may set a short timer, and if the timer expires
- before the network system call completes, the call will fail with
- errno set to EINTR.
-
- The example in this directory may be used as a model of how to
- interrupt a network system call with an alarm, or the example may
- be used without modification in your application.
-
- The function that does all the work is named host_responds_quickly,
- and it is found in file hrq.c. The application that calls this
- function must #include header file hrq.h. The file main.c contains
- a trivial driver that calls host_responds_quickly.
-
- An application written in a shell language may invoke the complete
- program hrq. There's an example of how this can be done in the
- Bourne shell in script file hrq.sh.
-
- Program hrq (and any other program calling host_responds_quickly)
- needs to be installed setuid to root. In a root shell, type
-
- chown root.sys hrq
- chmod 4755 hrq
- mv hrq /usr/local/bin
-
-
-
-